Developer Documentation

QuickTime 4 API Documentation

Inside Macintosh: More Macintosh Toolbox

Previous | Chapter Top | Chapter Contents | Next |

Working With Component Reference Constants

The Component Manager provides routines that manage access to the reference constants that are associated with components. There is one reference constant for each component, regardless of the number of connections to that component. When your component is registered, the Component Manager sets this reference constant to 0.

The reference constant is a 4-byte value that your component can use in any way you decide. For example, you might use the reference constant to store the address of a data structure that is shared by all connections maintained by your component. You should allocate shared structures in the system heap. Your component should deallocate the structure when its last connection is closed or when it is unregistered.

Use the SetComponentRefcon procedure to set the value of the reference constant for your component. Use the GetComponentRefcon function to retrieve the value of the reference constant.

SetComponentRefcon

You can use the SetComponentRefcon procedure to set the reference constant for your component.

PROCEDURE SetComponentRefcon (aComponent: Component;
                                         theRefcon: LongInt);
aComponent
A component identifier that specifies the component whose reference constant you wish to set.
theRefCon
The reference constant value that you want to set for your component.

DESCRIPTION

The SetComponentRefcon procedure sets the value of the reference constant for your component. Your component can later retrieve the reference constant using the GetComponentRefcon function, described next.

GetComponentRefcon

The GetComponentRefcon function retrieves the value of the reference constant for your component.

FUNCTION GetComponentRefcon (aComponent: Component): LongInt;
aComponent
A component identifier that specifies the component whose reference constant you wish to get.

DESCRIPTION

The GetComponentRefcon function returns a long integer containing the reference constant for the specified component.


© 1999 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents | Next